<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use App\Models\Config;
use App\Libraries\EasyClass;
//use App\Libraries\Alert;


class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public $config=[];
    public $request;
    public $easyClass;
    public $easyWeChat;
    public $data;
    public $alert;

    public function __construct(){
        $this->middleware('auth');

        $this->easyClass = new EasyClass();
        $this->easyWeChat = new \EasyWeChat();

        $list = Config::all()->toArray();
        foreach ($list as $item) {
            $this->config[$item['mod']]=$item['config'] ? array_map('base64_decode',json_decode($item['config'],true)):array();
        }

        $this->data["config"] = $this->config;
    }

    public function showView($template){
        return view($template, $this->data);
    }

}
